/*
* Copyright 2018 Shanxi Lu'an Taihang Laihui Net Tech co.,LTD.
*/
package com.laihuichuxing.prototype;

import java.io.IOException;

/**
 * Description:
 *
 * @author: Qinxuefeng
 * @since: 1.0
 * Create Date Time: 2018/12/18 11:36
 * Update Date Time:
 */

public class Main {
    public static void shallowCopy() throws CloneNotSupportedException {
        Resume resume = new Resume();
        resume.setAge(22);
        resume.setName("秦雪峰");
        resume.setGender("男");
        resume.setWorkExperience("2008-2018","xx公司");
        Resume bresume = (Resume) resume.clone();
        resume.setWorkExperience("2010-2018","gg公司");
        Resume cresume = (Resume) resume.clone();
        resume.setWorkExperience("2012-2018","yy公司");
        System.out.println(">>>>>>浅度拷贝:");
        resume.display();
        bresume.display();
        cresume.display();
    }
    public static void deepCopy() throws CloneNotSupportedException, IOException, ClassNotFoundException {
        Resume resume = new Resume();
        resume.setAge(22);
        resume.setName("秦雪峰");
        resume.setGender("男");
        resume.setWorkExperience("2008-2018","xx公司");
        Resume bresume = (Resume) resume.deepClone();
        resume.setWorkExperience("2010-2018","gg公司");
        Resume cresume = (Resume) resume.deepClone();
        resume.setWorkExperience("2012-2018","yy公司");
        System.out.println(">>>>>>深度拷贝:");
        resume.display();
        bresume.display();
        cresume.display();
    }

    public static void main(String[] args) throws CloneNotSupportedException, IOException, ClassNotFoundException {
        // 浅度拷贝
        shallowCopy();

        System.out.println("==================================");

        // 深度拷贝
        deepCopy();
    }
}
